/*
* @Author: zhangzhirui
*/
const modulesFiles = require.context('./modules', true, /\.js$/)

// 不需要 `import app from './modules/app'`
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
  // 设置 './app.js' => 'app'
  const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
  const value = modulesFiles(modulePath)
  modules[moduleName] = value
  return modules
}, {})
export default modules

